<?php
/**
 * Short Description  
 *
 * Long Description 
 *
 * @copyright 
 * @version   $Id: GroupDAO.php 12 2011-04-09 08:58:51Z sandeep.manne@gmail.com $
 */

class GroupDAO extends Core_DAO
{
	protected $_name        = 'group';
	protected $_primary 	= 'group_id';
	
	const SUSPEND       = 0;
	const ACTIVATE      = 1;     
	
	public function addGroup($groupDetails)
	{
		$groupDetails["status"] = 1;
		return $this->insert($groupDetails);
	}
	
	public function removeGroup($groupId)
	{
		$where = $this->getDefaultAdapter()
                      ->quoteInto('group_id = ?', $groupId);
		
		$data   = array('status' => self::SUSPEND);
		$result = $this->updateData($data, $where);	
		
		return $result;
	}
	
	public function getAllGroups()
	{
		return $this->select()
					->from($this->_name)
					->where("status = ?", 1)
					->query()
					->fetchAll();
	}
}